﻿using ViewMaker.Core.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ViewMaker.Core;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Data;

namespace ViewMaker.Core.Tests
{

    [TestClass()]
    public class DatePickerViewControlTest
    {
        [TestMethod()]
        public void 標準的なDatePickerのXAML生成()
        {
            var target = new DatePickerViewControl { Item = new ViewLayoutItem { Name = "dp001", Caption = "日付", BindPath = "currentValue" } };
            var xaml = target.CreateXaml(TestHelper.CreateTestParent())[1];

            var actual = TestHelper.GetFrameworkElement<DatePicker>(xaml);
            Assert.AreEqual("dp001", actual.Name);
            Assert.AreEqual("currentValue", actual.GetBindingExpression(DatePicker.SelectedDateProperty).ParentBinding.Path.Path);
            Assert.AreEqual(BindingMode.TwoWay, actual.GetBindingExpression(DatePicker.SelectedDateProperty).ParentBinding.Mode);
        }

        [TestMethod()]
        public void DatePickerViewControlの編集画面が表示可能()
        {
            var target = new DatePickerViewControl { Item = new ViewLayoutItem { Name = "dp001", Caption = "日付", BindPath = "currentValue" } };
            var baml = ViewUtil.BuildContent(target);
            Assert.IsNotNull(baml);
        }

    }
}
